package com.kundi.dooradmin.service;

import com.kundi.dooradmin.entity.CompanyDynamic;
import com.kundi.dooradmin.mapper.CompanyDynamicMapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * Author 赵恒
 * Date 2020/6/17
 */
@Service
public class CompanyDynamicService {
    @Resource
    CompanyDynamicMapper companyDynamicMapper;

    /**
     * 添加公司动态
     * @param companyDynamic
     * @return
     */
    public Integer add(CompanyDynamic companyDynamic) {
        return companyDynamicMapper.insertSelective(companyDynamic);
    }

    /**
     * 获取所有的公司动态
     * @return
     */
    public List<CompanyDynamic> getAll() {
        return companyDynamicMapper.getAll();
    }

    public String getContentById(Integer id) {
        return companyDynamicMapper.getContentById(id
        );
    }

    public CompanyDynamic getDynamicById(Integer id) {
        return companyDynamicMapper.getDynamicById(id);
    }

    /**
     * 修改公司动态
     * @param companyDynamic
     * @return
     */
    public Integer update(CompanyDynamic companyDynamic) {
        return companyDynamicMapper.updateByPrimaryKey(companyDynamic);
    }

    public Integer delete(Integer id) {
        return companyDynamicMapper.deleteById(id);
    }

    public List<CompanyDynamic> getRecentDynamic() {
        return companyDynamicMapper.getRecentDynamic();
    }
}
